package com.ruoyi.lhh.config;

import com.ruoyi.lhh.bean.Person;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 人员默认配置信息
 *
 */
@Configuration //配置文件注解
public class PersonConfig {
    @Bean//默认向spring 容器中注入一个对象
    public Person person() {
        Person aaa = new Person();
        aaa.setName("liuhh");
        aaa.setAge(100);
        return aaa;
    }


    public static void main(String[] args) {
        AnnotationConfigApplicationContext annotationContext = new AnnotationConfigApplicationContext();
        Person bean = annotationContext.getBean(Person.class);
        System.out.println(bean);
//        String[] beanNamesForType = annotationContext.getBeanNamesForType(Person.class);
//        for (String s : beanNamesForType) {
//            System.out.println(s);
//
//        }

    }

}
